
$(function(){
	$.ajax({
		type:"POST",
		url:"/industry/getTree",
		success:function(d){	
			console.log(d.data);
			layui.use('tree', function(){
			    var tree = layui.tree;
			    
			    //渲染
			    tree.render({
			        elem: '#test1', //默认是点击节点可进行收缩
			        showLine: false,  //是否开启连接线
			        onlyIconControl: true,
			        data: d.data,
			        click: function(obj){
			        	let data = obj.data;
			        	  //给父页面
				           parent.$("#parentId").val(data.id);
				           parent.$("#parentName").val(data.label);
			        /*	console.log(data);
			       
			        	layui.use('layer',function(){
			        		var $ = layui.$,
			        		layer = layui.layer,
			        		index = parent.layer.getFrameIndex(window.name);
			        		
			        	//	alert(index);
			        		
			        		parent.layer.tips('Look here', '#parentName', {time: 5000});
			        		
			        		parent.$('#parentId').text(data.id);
			        		parent.$('#parentName').text(data.title);
			        		
			        		parent.layer.close(index);
			        	});
			        	*/
			        	/*var index = parent.layer.getFrameIndex("info.html");
			        	
			        	parent.$('#parentId').text(data.id);
			        	parent.$('#parentName').text(data.title);
			            parent.layer.close(index);*/
			        }
			      });
			  });
		}
	});
})


